package com.jxj.entity;

import lombok.Data;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * 用于定义返回消息格式的类
 * @Author Cambria
 * @creat 2021/8/14 23:10
 */
@Data
public class Resp<T> {
    private int code;
    private String msg;
    private T data;

    public Resp(HttpStatus code, String msg, T data) {
        this.code = code.value();
        this.msg = msg;
        this.data = data;
    }

    public Resp(HttpStatus code, T data) {
        this.code = code.value();
        this.msg = code.name();
        this.data = data;
    }
}
